package com.tee.live.im.provider;

import com.tee.live.im.provider.service.ImTokenService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;



/**
 * @author tee
 * @date 2025/10/24
 */
@SpringBootApplication
@EnableDubbo
public class ImProviderApplication implements CommandLineRunner {


    @Resource
    private ImTokenService imTokenService;
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(ImProviderApplication.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.run(args);
    }

    @Override
    public void run(String... args) throws Exception {
        long userID = 10921312L;
        String imLoginToken = imTokenService.createImLoginToken(userID, 10001);
        System.out.println(imLoginToken);
        Long userIdByToken = imTokenService.getUserIdByToken(imLoginToken);
        System.out.println("userId:" + userIdByToken);
    }
}
